﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using HFController;
namespace HFWebApp.source
{
    public partial class SourceList : BagePages
    {
        public string ListTitle = "";
        public string PageStr = "";
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                int PageSize = 18;
                int PageNumber = 1;
                if (this.GetQuery("Page") != "")
                {
                    PageNumber = int.Parse(this.GetQuery("Page"));
                }
                int total = 0;
                string strWhere = "";

                #region 搜索条件
                if (this.GetQuery("sourceid") != "")
                {
                    int sourceid = int.Parse(this.GetQuery("sourceid"));
                    strWhere = "SourceID = " + sourceid.ToString();
                    ListTitle = SourceController.getController().getSourceClassModel(sourceid).ClassName;
                }
                string wordkey = this.GetQuery("wordkey");
                if (wordkey != "")
                {
                    if (strWhere != "")
                    {
                        strWhere = strWhere + " and Title like '" + wordkey + "'";
                    }
                    else {
                        strWhere = "Title like '" + wordkey + "'";
                    }
                }
                #endregion

                Repeater1.DataSource = SourceController.getController().getSourceList(PageSize, PageNumber, strWhere, out total);
                Repeater1.DataBind();
                PageStr = LLL.Pager.TrunPageHtmlCode_Web(PageSize, PageNumber, total, "");
            }
        }
    }
}